<?require_once("conn.php");?>
<script>
	$( document ).ready(function() {  
		$("#pro_exp").datepicker({
			dateFormat: 'ddmmy',
			onSelect: function(dateText, inst) {
				var strCode = "";
				var tmp = $("#send_item").val().split(":");
				//alert($("#pro_cat").val());
				//alert(tmp[1]);
				if(tmp[1] == ""){
					alert("สินค้านี้ยังไม่มี Barcode");
				}else{
					strCode = tmp[1]+$("#pro_exp").val();
					$("#sendBarcode").val(strCode);
				}
				//alert($("#log_exp").val());
			}
		});

		$('#pro_check_exp').change(function() {
			if($(this).is(":checked")) {
				$("#showExp").show();
			}else{
				$("#showExp").hide();
				$("#pro_exp").val("");
				var tmp = $("#send_item").val().split(":");
				if(tmp[1] == ""){
					alert("สินค้านี้ยังไม่มี Barcode");
				}else{
					strCode = tmp[1]+$("#pro_exp").val();
					$("#sendBarcode").val(strCode);
				}
			}
		});
	});
</script>
<table id="sendOfficeData" width="100%">
	<tr>
		<td width="100">Category : </td>
		<td>
			<select id="send_cat" onchange="updateSendItem()">
				<option value="">&nbsp;</option>
				<?
					$sql = "SELECT * FROM pch_category;";
					$query = mysql_query($sql);
					while($row = mysql_fetch_array($query)){
					?>
						<option value="<?=$row["id"]?>"><?=$row["category_name"]?></option>
					<?
					}
				?>
			</select>
		</td>
	</tr>
	<tr>
		<td>Item : </td>
		<td>
			<input type="hidden" id="send_index" value="1">
			<input type="hidden" id="send_name" value="">
			<input type="hidden" id="send_unittext">
			<span id="send_show_item"><select><option value="1">Please Select Category</option></select></span>	
		</td>
	</tr>
	<tr>
		<td>Has Expired : </td>
		<td><input type="checkbox" id="pro_check_exp"><span id="showExp" style="display:none;">Expired Date : <input type="text" id="pro_exp"></span></td>
	</tr>
	<tr>
		<td>Amount : </td>
		<td><input type="text" id="send_amount" style="width:100px;" onkeypress="return numbersonly(event)"></td>
	</tr>
	<tr>
		<td>Unit : </td>
		<td>
			<select id="send_unit" onchange="updateSendIslandUnit()">
					<option value="">&nbsp;</option>
					<?
						$sqlP = "SELECT * FROM pch_unit ORDER BY unit_name;";
						$queryP = mysql_query($sqlP);
						while($rowP = mysql_fetch_array($queryP)){
					?>
						<option value="<?=$rowP["id"]?>"><?=$rowP["unit_name"]?></option>
					<?
						}
					?>
				</select>
		</td>
	</tr>
	<tr>
		<td>Barcode</td>
		<td><input type="text" id="sendBarcode" readonly></td>
	<tr>
		<td colspan="2"><input type="button" value="Add" id="btnAddtmpSendIsland" onclick="addrowSendIsland()" style="width:90px;"></td>
		
	</tr>
</table>
<div id="sendOffice_list"><script>updateSendCart();</script></div>
<!--
<table id="sendOffice_list" width="750" border="1" style="display:none;">
	<tr>
		<td colspan="5">รายการส่งของลงเกาะวันที่  <?=date("d/m/Y");?></td>
	</tr>
	<tr>
		<td width="600">Item</td>
		<td width="50" align="center">Amount</td>
		<td width="50" align="center">Unit</td>
		<td width="50">&nbsp;</td>
	</tr>
</table>
-->